<style>
    .parent_cla{
        display: none;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="" autocomplete="off">

    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">-->
        <!--</div>-->
    <!--</div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('类别')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                <label for="type-1"><input class="form-input-type" id="type-1" name="row[type]" type="radio" value="1" checked> 幼儿</label>
                <label for="type-2"><input class="form-input-type"  id="type-2" name="row[type]" type="radio" value="2"> 小学</label>
                <label for="type-3"><input class="form-input-type"  id="type-3" name="row[type]" type="radio" value="3"> 小学</label>
                <label for="type-4"><input class="form-input-type"  id="type-4" name="row[type]" type="radio" value="4"> 小学</label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('班号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-number" data-rule="required" class="form-control" name="row[number]" type="text" value="">
        </div>
    </div>

    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-12 col-sm-2">{:__('Org_cate_id')}:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<select  id="c-org_cate_id" data-rule="required" class="form-control selectpicker" name="row[org_cate_id]" onchange="change_cate(this)">-->
                <!--{foreach name="orgName_tree" item="vo"}-->
                    <!--<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
                <!--{/foreach}-->
            <!--</select>-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-12 col-sm-2">{:__('级别')}:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->

            <!--<div class="radio">-->
                <!--<label for="row[level]-1"><input id="row[level]-1" name="row[level]" type="radio" value="1" checked onchange="chage_level(this)"/> 年级</label>-->
                <!--<label for="row[level]-2"><input id="row[level]-2" name="row[level]" type="radio" value="2"  onchange="chage_level(this)"/> 班级</label>-->
            <!--</div>-->

        <!--</div>-->
    <!--</div>-->
    <!--<div class="form-group parent_cla">-->
        <!--<label class="control-label col-xs-12 col-sm-2">{:__('父级')}:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<select  id="c-parent_id" class="form-control" name="row[parent_id]">-->
                <!--<option value="0" selected>顶级</option>-->
            <!--</select>-->
        <!--</div>-->
    <!--</div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<input id="c-create_time" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-12 col-sm-2">{:__('Introduce')}:</label>-->
        <!--<div class="col-xs-12 col-sm-8">-->
            <!--<input id="c-introduce" data-rule="required" class="form-control" name="row[introduce]" type="text" value="">-->
        <!--</div>-->
    <!--</div>-->
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
<script>
    function chage_level(obj)
    {
        var level = $(obj).val();
        console.log('level',level);
        if(level == 2){
            $('.parent_cla').show();
        }else{
            $('.parent_cla').hide();
        }
    }
    function change_cate(obj){
        var cate_id = $(obj).val();
        console.log('cate_id',cate_id);
        $.ajax({
            url:'ajax/orggroup',
            data: {cate_id:cate_id},
            type:'POST',
            dataType: "json",
            success: function (res) {
                htmls ='<option value="0" selected>顶级</option>';
                if(res.data.level != 3){
                    Toastr.error('请选择三级行业');
                }else{
                    var list = res.data.groups;
                    if(list.length > 0){
                        htmls = '';
                        for(let i = 0; i<list.length;i++){
                            htmls+=' <option value="'+list[i].id+'">'+list[i].name+'</option>';
                        }
                    }else{
                        htmls+='<option value="0" selected>顶级</option>';
                    }

                }
                $('#c-parent_id').html(htmls);
            }
        });
    }
</script>
